package com.zhike.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhike.model.NewMessage;
import com.zhike.model.WorkFlowTask;
import com.zhike.service.MessageService;
import com.zhike.util.JsonUtil;

@Controller
public class MessageController {
	@Autowired
	MessageService messageService;
	
	/**用户消息推送到指定别名用户
	 * 
	 */
	@ResponseBody
	@RequestMapping(value="api/push",method=RequestMethod.GET,produces="application/json;charset=utf-8")
	private String messagePush(NewMessage message) {
		messageService.messagePush(message);
		return JsonUtil.blank(true, 200, "接口调用成功");
		
	}
	//实验室管理系统的测试
			@ResponseBody
			@RequestMapping(value="api/push/laboratory",produces="application/json;charset=utf-8")
			private String messagePushLaboratory(NewMessage message) {
				String string = messageService.messagePushLaboratory(message);
				return JsonUtil.blank(true, 200, "接口调用成功");	
			}
			
			//根据id查询待办事项列表的详情数据
			@ResponseBody
			@RequestMapping(value="api/messageList/laboratory",produces="application/json;charset=utf-8")
			private String messageListLaboratory(WorkFlowTask workFlowTask) {
				String string = messageService.messageListLaboratory(workFlowTask);
				return string;	
			}
	
	/**
	 * 待办事项列表
	 */
	@ResponseBody
	@RequestMapping(value="api/taskmatter",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String backlogList(NewMessage message) {
		String str   = messageService.backlogList(message);
		return str;
		
	}

	/**
	 * 代办个数
	 */
	@ResponseBody
	@RequestMapping(value="api/taskmatter/count",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String backlogCount(NewMessage message) {
		String str   = messageService.backlogCount(message);
		return str;
		
	}
}
